package test

import (
	"fmt"
	"github.com/jinzhu/gorm"
	"managementsystem/conn"
	"managementsystem/structs"
)

//按年龄统计人数
func AgeSta(db *gorm.DB){
	var Results []structs.AgeSta
	err := db.Table("agesta").Find(&Results).Error
	conn.ErrCheck(err)

	for _,v :=range Results{
		fmt.Println(v)
	}
}

//统计地区
func LocSta(db *gorm.DB){
	var Results []structs.LocSta
	err := db.Table("locsta").Find(&Results).Error
	conn.ErrCheck(err)

	for _,v :=range Results{
		fmt.Println(v)
	}
}

//统计政治面貌
func PolSta(db *gorm.DB){
	var Results []structs.PolSta
	err := db.Table("polsta").Find(&Results).Error
	conn.ErrCheck(err)

	for _,v :=range Results{
		fmt.Println(v)
	}
}

